<?php

/**
 * This is the model class for table "mall_order_parent".
 *
 * The followings are the available columns in table 'mall_order_parent':
 * @property string $id
 * @property string $order_num
 * @property string $user_id
 * @property string $child_order
 * @property string $num
 * @property double $total_price
 * @property double $discount
 * @property string $consignee
 * @property string $moble
 * @property string $address
 * @property integer $status
 * @property integer $payby
 * @property double $account_platfrom
 * @property double $account_other
 * @property string $pay_info
 * @property string $create_time
 * @property string $update_time
 * @property string $created_by
 * @property string $updated_by
 * @property integer $is_delete
 * @property string $Shipping
 */
class MallOrderParent extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return MallOrderParent the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'mall_order_parent';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('order_num, user_id, num, total_price, consignee, moble, address, Shipping', 'required'),
			array('status, payby, is_delete', 'numerical', 'integerOnly'=>true),
			array('total_price, discount, account_platfrom, account_other', 'numerical'),
			array('order_num, address, created_by, updated_by', 'length', 'max'=>255),
			array('user_id, moble', 'length', 'max'=>20),
			array('num', 'length', 'max'=>10),
			array('consignee', 'length', 'max'=>120),
			array('Shipping', 'length', 'max'=>4),
			array('child_order, pay_info, create_time, update_time', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, order_num, user_id, child_order, num, total_price, discount, consignee, moble, address, status, payby, account_platfrom, account_other, pay_info, create_time, update_time, created_by, updated_by, is_delete, Shipping', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'order_num' => 'Order Num',
			'user_id' => 'User',
			'child_order' => 'Child Order',
			'num' => 'Num',
			'total_price' => 'Total Price',
			'discount' => 'Discount',
			'consignee' => 'Consignee',
			'moble' => 'Moble',
			'address' => 'Address',
			'status' => 'Status',
			'payby' => 'Payby',
			'account_platfrom' => 'Account Platfrom',
			'account_other' => 'Account Other',
			'pay_info' => 'Pay Info',
			'create_time' => 'Create Time',
			'update_time' => 'Update Time',
			'created_by' => 'Created By',
			'updated_by' => 'Updated By',
			'is_delete' => 'Is Delete',
			'Shipping' => 'Shipping',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id,true);
		$criteria->compare('order_num',$this->order_num,true);
		$criteria->compare('user_id',$this->user_id,true);
		$criteria->compare('child_order',$this->child_order,true);
		$criteria->compare('num',$this->num,true);
		$criteria->compare('total_price',$this->total_price);
		$criteria->compare('discount',$this->discount);
		$criteria->compare('consignee',$this->consignee,true);
		$criteria->compare('moble',$this->moble,true);
		$criteria->compare('address',$this->address,true);
		$criteria->compare('status',$this->status);
		$criteria->compare('payby',$this->payby);
		$criteria->compare('account_platfrom',$this->account_platfrom);
		$criteria->compare('account_other',$this->account_other);
		$criteria->compare('pay_info',$this->pay_info,true);
		$criteria->compare('create_time',$this->create_time,true);
		$criteria->compare('update_time',$this->update_time,true);
		$criteria->compare('created_by',$this->created_by,true);
		$criteria->compare('updated_by',$this->updated_by,true);
		$criteria->compare('is_delete',$this->is_delete);
		$criteria->compare('Shipping',$this->Shipping,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}